package com.apes.fn.fico.prefetch.model;

import com.apes.fn.fico.reimbursement.model.FeeType;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.frame.model.DutyCenter;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @Title: PrefetchExpenseItem
 * @Description: 预提费用明细
 * @author: ZhengZeXian
 * @create: 2022年2月14日17:25:20
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicUpdate
@DynamicInsert
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = PrefetchExpenseItem.CONST_TABLE_NAME)
public class PrefetchExpenseItem extends BaseModel {

    public static final String CONST_TABLE_NAME = "fn_prefetch_expense_item";

    @Id
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "预提费用明细", padding = 7)
    @Comment("预提费用明细编码")
    private String id;

    @ManyToOne(optional = false)
    @JoinColumn(name = "prefetch_expense_id", referencedColumnName = "id")
    @Comment("预提费用")
    private PrefetchExpense prefetchExpense;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "duty_center_id", referencedColumnName = "id")
    @Comment("成本中心")
    private DutyCenter dutyCenter;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "fee_type_id", referencedColumnName = "id")
    @Comment("费用类型")
    private FeeType feeType;

    @Column(name = "january", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("一月")
    private double january = 0;

    @Column(name = "february", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("二月")
    private double february = 0;

    @Column(name = "march", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("三月")
    private double march = 0;

    @Column(name = "april", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("四月")
    private double april = 0;

    @Column(name = "may", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("五月")
    private double may = 0;

    @Column(name = "june", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("六月")
    private double june = 0;

    @Column(name = "july", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("七月")
    private double july = 0;

    @Column(name = "august", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("八月")
    private double august = 0;

    @Column(name = "september", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("九月")
    private double september = 0;

    @Column(name = "october", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("十月")
    private double october = 0;

    @Column(name = "november", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("十一月")
    private double november = 0;

    @Column(name = "december", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("十二月")
    private double december = 0;

}
